<?php
	include("includes/connect.php");
	include("includes/function.php");


	$tablename = $_POST["tablename"];
	$dd = $_POST["dd"];
	$fieldname = $_POST["fieldname"];
	$idname = $_POST["idname"];
	$by = $_POST["by"];

	$db = new myDBS;

	$where = "expend_sub_id = $by";
	$result = $db->showData1($tablename, $where);
?>
<script type="text/javascript">
	$(document).ready(function(){
		$( "#<?php echo $dd; ?>" ).change(function() {
			var by= $(this).val();

			//alert(by);
			
		});
	});
</script>
<select class="span12" id="<?php echo $dd; ?>" name="<?php echo $dd; ?>" >
	<option>เลือก...</option>
	<?php
		while ( $rows = $db->fetch_object ( $result )){
	?>
	<option value="<?php echo $rows->{$idname}; ?>"><?php echo $rows->{$fieldname}; ?></option>
	<?php } ?>
</select>